<%@page import="cn.jhc.dao.ShopDAO"%>
<%@page import="cn.jhc.bean.UserBean"%>
<%@page import="cn.jhc.bean.ShopBean"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/houtai.css"></link>
<title>具体订单信息</title>
</head>
<body>
	<div id="wrapper">
		<jsp:include page="./houtai_header.jsp"></jsp:include>
		<div id="left">
			<div class="button2"><a href="adminchecklist.jsp?judgment=T&judgment2=T">订单信息</a></div>
			<div class="button"><a href="houtai_addjita.jsp">增加吉他</a></div>
			<div class="button"><a href="deletejita.do?bl=all">删除吉他</a></div>
			<div class="button"><a href="alterjita.jsp">吉他信息</a></div>
		</div>
		<div id="right">
			<div id="right_top">
				<a>所在位置： 订单信息>具体订单信息</a>
			</div>
			<%
				String list_id = request.getParameter("id");
				int List_id = Integer.parseInt(list_id);
				List<ShopBean> listgoods = new ArrayList<ShopBean>();
				UserBean adminuser = (UserBean) session.getAttribute("adminuser");
				int Page = Integer.parseInt(request.getParameter("Page"));
				String date = request.getParameter("date");
				String time = request.getParameter("time");
				int Pagecount = 1;
				String datetime = date + " " + time;
				ShopDAO dao = null;
				if (null != adminuser) {
					dao = new ShopDAO();
					String user = request.getParameter("user");
					try {
						listgoods = dao.AdminChecklistgoods(user, datetime);
					} catch (Exception e) {
						e.printStackTrace();
					}
					if (listgoods.size() == 0) {
						RequestDispatcher dispatcher = request
								.getRequestDispatcher("/adminchecklist.jsp?judgment=T&judgment2=F");
						dispatcher.forward(request, response);
					} else {
						Pagecount = (listgoods.size() + 12) / 13;
						request.setAttribute("listgoods", listgoods);
					}
				}

				else {
					String getb = "/index.jsp";
					request.setAttribute("getb", getb);
					RequestDispatcher dispatcher = request
							.getRequestDispatcher("/houtai_login.jsp");
					dispatcher.forward(request, response);
					return;
				}
			%>
			<table width="100%" align="center">
				<tr>
					<th>用户名</th>
					<th>标题</th>
					<th>单价</th>
					<th>数量</th>
					<th>总价</th>
					<th>购物时间</th>
					<th>操作</th>
				</tr>
				<c:forEach items="${requestScope.listgoods}" var="shop"
					begin="<%=(Page-1)*12%>" end="<%=Page*12%>">
					<tr>

						<td align="center">${shop.user}</td>
						<td align="center">${shop.title}</td>
						<td align="center">${shop.price}</td>
						<td align="center">${shop.amount}</td>
						<td align="center">${shop.totalprice}</td>
						<td align="center">${shop.date}-${shop.time}</td>
						<td align="center"><a href="houtaideletelistgoods.do?date=${shop.date}&time=${shop.time}&user=${shop.user}&id=${shop.id}&price=${shop.price}&amount=${shop.amount}&List_id=<%=List_id%>">删除</a></td>
					</tr>
				</c:forEach>
			</table>
			<div align="right">
				<a>第<%=Page%>页
				</a><a>共<%=Pagecount%>页
				</a>
				<%
					if (Page == 1) {
				%>
				<a>首页</a>
				<%
					} else {
				%>
				<a
					href="adminchecklistgoods.jsp?Page=1&date=<%=date%>&time=<%=time%>&id=<%=list_id%>">首页</a>
				<%
					}
				%>
				<%
					if (Page < 2) {
				%>
				<a>上一页</a>
				<%
					} else {
				%>
				<a
					href="adminchecklistgoods.jsp?Page=<%=Page - 1%>&date=<%=date%>&time=<%=time%>&id=<%=list_id%>">上一页</a>
				<%
					}
				%>
				<%
					if (Page < Pagecount) {
				%>
				<a
					href="adminchecklistgoods.jsp?Page=<%=Page + 1%>&date=<%=date%>&time=<%=time%>&id=<%=list_id%>">下一页</a>
				<%
					} else {
				%>
				<a>下一页</a>
				<%
					}
				%>
				<%
					if (Page == Pagecount) {
				%>
				<a>末页</a>
				<%
					} else {
				%>
				<a
					href="adminchecklistgoods.jsp?Page=<%=Pagecount%>&date=<%=date%>&time=<%=time%>&id=<%=list_id%>">末页</a>
				<%
					}
				%>
				<a
					href="adminchecklist.jsp?Page=1&date=<%=date%>&judgment=F&judgment2=T">返回订单页面</a>
			</div>

		</div>
	</div>
</body>
</html>